// stores/user.js  
import {
	defineStore
} from 'pinia'
import {
	ref
} from 'vue'

export const useUserStore = defineStore('user', () => {
	// 状态定义 
	const token = ref('')
	const userInfo = ref({
		name: 'Guest',
		avatar: ''
	})

	// 方法定义 
	const login = (payload) => {
		token.value = payload.token
		userInfo.value = payload.userInfo
	}

	return {
		token,
		userInfo,
		login
	}
})